<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>管理员登录</title>
    <link rel="stylesheet" type="text/css" href="./css/style.css"/>
    <link rel="stylesheet" type="text/css" href="./css/body.css"/>
    <link rel="stylesheet" type="text/css" href="./css/znsw.css"/>
    <link rel="stylesheet" type="text/css" href="./css/buttons.css"/>
    <script type="text/javascript" src="./md5.js"></script>
    <script type="text/javascript" src="./register.js"></script>
    <script type="text/javascript" src="./jquery-1.8.0.min.js"></script>
</head>
<body>

<div class="container">
    <section id="content">
        <form action="/login" method="post">
            <h1>会员登录</h1>
            <div>
                <input type="text" placeholder="邮箱" required="" id="username"
                       name="username"/>
            </div>
            <div>
                <input type="password" placeholder="密码" required="" id="passwd"
                       name="password"/>
            </div>
            <div class="">
                <span class="help-block u-errormessage" id="js-server-helpinfo">&nbsp;</span>
            </div>
            <div>

                <input type="hidden" id="timestamp" name="timestamp"> <input
                    type="hidden" id="salt" name="salt"> <input type="hidden"
                                                                id="clientHash" name="clientHash">
                <script
                        type="text/javascript">
                    function clogin() {
                        //获取密码
                        var passwd = $("#passwd").val();

                        var tnp = md5(passwd);
                        //获取时间
                        var date = new Date();
                        var month = date.getMonth();
                        month = (month < 10 ? "0" + month : month);
                        var timestamp = date.getFullYear() + "/"
                                + month + "/" + date.getDate() + " "
                                + date.getHours() + ":"
                                + date.getMinutes();
                        //随机数
                        var salt = Math.floor(Math.random() * 100 + 1);
                        //把对象放入json传入后台

                        var clientHash = md5(tnp + timestamp + salt);
                        $("#timestamp").val(timestamp);
                        $("#clientHash").val(clientHash);
                        $("#salt").val(salt);
                        $("#passwd").val(tnp);

                        var msg = JSON.stringify({
                            "timestamp": timestamp,
                            "clientHash": clientHash,
                            "salt": salt
                        });
                        console.info(msg);

                        frm1.submit();
                    }
                </script>
                <!-- <input type="submit" value="Log in" /> -->
                <input type="submit" value="登录" class="btn btn-primary" id="js-btn-login"
                       onclick="clogin();"/>

                <a href="#">忘记密码?</a>
                <!-- <a href="#">Register</a> -->
            </div>
        </form>
        <!-- form --> </section>
    <!-- content -->
</div>
<!-- container -->

</body>
</html>